package leetcodecompetition.D372;

/**
 * @Author: Siantar
 * @Date: 2023-11-19-10:40
 * @Description: 1.0
 */
public class T100122 {
    public long minimumSteps(String s) {
        int t = 0;
        long res = 0;
        boolean b = false;
        for (char c : s.toCharArray()) {
            if (c == '0') {
                res += t;
                t = Math.max(0, t - 1);
            }
            if (c == '1' || b) {
                t++;
                b = true;
            }
            System.out.println(t);
        }
        return res;
    }
}
